﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FBroSharp.DataType;
using FBroSharp;

namespace 创建弹窗浏览器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }
        public void CreateBrowser(string url, IntPtr PrantWindowsPtr, string WindowName,int Left, int Top)
        {
            FBroSharpWindowsInfo windowsInfo = new FBroSharpWindowsInfo
            {
                parent_window = PrantWindowsPtr,
                x = Left,
                y = Top,
                width = this.ClientSize.Width,
                height = this.ClientSize.Height,
                window_name = WindowName
            };
            BrowserEvent browser_event = new BrowserEvent();

            FBroSharpControl.CreatBrowser(url, windowsInfo, default, default, default, browser_event, default);

        }

        private void ButtonClick(object sender, EventArgs e)
        {
            Button Btn = (Button)sender;
            string url = "www.baidu.com";

            if (Btn == button1)
            {

                CreateBrowser(url, IntPtr.Zero, "button1创建的弹窗浏览器",100,100);
            }
            else if (Btn == button2)
            { 
                CreateBrowser(url, IntPtr.Zero, "button2创建的弹窗浏览器", 300, 100);

            }
        }
    }
}
